﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;
using System.Diagnostics;
using System.Diagnostics.Contracts;

namespace ShredTheLog.Controls
{
    public sealed class ShellHyperlink : Hyperlink
    {
        public ShellHyperlink()
        {
            RequestNavigate += (sender, e) => Process.Start(e.Uri.ToString());
        }

        public ShellHyperlink(string text, string navigateUri)
            : this()
        {
            Contract.Requires(!String.IsNullOrWhiteSpace(text));
            Contract.Requires(!String.IsNullOrWhiteSpace(navigateUri));
            
            Inlines.Add(new Run(text));
            NavigateUri = new Uri(navigateUri);
        }

        public ShellHyperlink(string navigateUri)
            : this(navigateUri, navigateUri)
        {
            Contract.Requires(!String.IsNullOrWhiteSpace(navigateUri));
        }
    }
}
